home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Personal Computer World 2009 February
/
PCWFEB09.iso
/
Software
/
Linux
/
Kubuntu 8.10
/
kubuntu-8.10-desktop-i386.iso
/
casper
/
filesystem.squashfs
/
var
/
lib
/
dpkg
/
info
/
udev.postrm
< prev
next >
Wrap
Text File
|
2008-10-24
|
7KB
|
277 lines
#!/bin/sh -e
# This script can be called in the following ways:
#
# After the package was removed:
# <postrm> remove
#
# After the package was purged:
# <postrm> purge
#
# After the package was upgraded:
# <old-postrm> upgrade <new-version>
# if that fails:
# <new-postrm> failed-upgrade <old-version>
#
#
# After all of the packages files have been replaced:
# <postrm> disappear <overwriting-package> <version>
#
#
# If preinst fails during install:
# <new-postrm> abort-install
#
# If preinst fails during upgrade of removed package:
# <new-postrm> abort-install <old-version>
#
# If preinst fails during upgrade:
# <new-postrm> abort-upgrade <old-version>
# Undo removal of a no-longer used conffile
undo_rm_conffile()
{
CONFFILE="$1"
if [ ! -e "$CONFFILE" ]; then
if [ -e "$CONFFILE".dpkg-bak ]; then
echo "Restoring modified conffile $CONFFILE"
mv -f "$CONFFILE".dpkg-bak "$CONFFILE"
elif [ -e "$CONFFILE".dpkg-obsolete ]; then
mv -f "$CONFFILE".dpkg-obsolete "$CONFFILE"
fi
fi
}
# Finish removal of a no-longer used conffile
finish_rm_conffile()
{
CONFFILE="$1"
if [ -e "$CONFFILE".dpkg-bak ]; then
rm -f "$CONFFILE".dpkg-bak
fi
}
# Undo move of a conffile
undo_mv_conffile()
{
CONFFILE="$1"
if [ ! -e "$CONFFILE" ]; then
if [ -e "$CONFFILE".dpkg-bak ]; then
mv -f "$CONFFILE".dpkg-bak "$CONFFILE"
elif [ -e "$CONFFILE".dpkg-moving ]; then
mv -f "$CONFFILE".dpkg-moving "$CONFFILE"
fi
fi
}
# Finish move of a conffile
finish_mv_conffile()
{
CONFFILE="$1"
if [ -e "$CONFFILE".dpkg-bak ]; then
rm -f "$CONFFILE".dpkg-bak
fi
}
# Undo rename of the persistent-disk.rules file
undo_mv_persistent_disk_rules()
{
undo_mv_conffile /etc/udev/rules.d/65-persistent-disk.rules \
/etc/udev/rules.d/60-persistent-storage.rules
}
# Finish rename of the persistent-disk.rules file
finish_mv_persistent_disk_rules()
{
finish_mv_conffile /etc/udev/rules.d/65-persistent-disk.rules \
/etc/udev/rules.d/60-persistent-storage.rules
}
# Undo rename the cdrom_id.rules file
undo_mv_cdrom_id_rules()
{
undo_mv_conffile /etc/udev/rules.d/50-cdrom_id.rules \
/etc/udev/rules.d/30-cdrom_id.rules
}
# Finish rename the cdrom_id.rules file
finish_mv_cdrom_id_rules()
{
finish_mv_conffile /etc/udev/rules.d/50-cdrom_id.rules \
/etc/udev/rules.d/30-cdrom_id.rules
}
# Undo rename of upstream rules files
undo_mv_upstream_rules()
{
undo_mv_conffile /etc/udev/rules.d/00-init.rules \
/etc/udev/rules.d/05-udev-early.rules
undo_mv_conffile /etc/udev/rules.d/65-persistent-input.rules \
/etc/udev/rules.d/60-persistent-input.rules
undo_mv_conffile /etc/udev/rules.d/65-persistent-storage.rules \
/etc/udev/rules.d/60-persistent-storage.rules
undo_mv_conffile /etc/udev/rules.d/65-persistent-storage-tape.rules \
/etc/udev/rules.d/60-persistent-storage-tape.rules
undo_mv_conffile /etc/udev/rules.d/65-persistent-storage-edd.rules \
/etc/udev/rules.d/61-persistent-storage-edd.rules
undo_mv_conffile /etc/udev/rules.d/99-udevmonitor.rules \
/etc/udev/rules.d/95-udev-late.rules
}
# Finish rename of upstream rules files
finish_mv_upstream_rules()
{
finish_mv_conffile /etc/udev/rules.d/00-init.rules \
/etc/udev/rules.d/05-udev-early.rules
finish_mv_conffile /etc/udev/rules.d/65-persistent-input.rules \
/etc/udev/rules.d/60-persistent-input.rules
finish_mv_conffile /etc/udev/rules.d/65-persistent-storage.rules \
/etc/udev/rules.d/60-persistent-storage.rules
finish_mv_conffile /etc/udev/rules.d/65-persistent-storage-tape.rules \
/etc/udev/rules.d/60-persistent-storage-tape.rules
finish_mv_conffile /etc/udev/rules.d/65-persistent-storage-edd.rules \
/etc/udev/rules.d/61-persistent-storage-edd.rules
finish_mv_conffile /etc/udev/rules.d/99-udevmonitor.rules \
/etc/udev/rules.d/95-udev-late.rules
}
# Undo remove the iftab.rules file
undo_rm_iftab_rules()
{
undo_rm_conffile /etc/udev/rules.d/25-iftab.rules
}
# Finish remove of the iftab.rules file
finish_rm_iftab_rules()
{
finish_rm_conffile /etc/udev/rules.d/25-iftab.rules
}
# Undo remove early rules files
undo_rm_early_rules()
{
undo_rm_conffile /etc/udev/rules.d/05-udev-early.rules
}
# Undo remove upstream rules files
undo_rm_upstream_rules()
{
undo_rm_conffile /etc/udev/rules.d/50-udev-default.rules
undo_rm_conffile /etc/udev/rules.d/80-drivers.rules
}
# Finish remove early rules files
finish_rm_early_rules()
{
finish_rm_conffile /etc/udev/rules.d/05-udev-early.rules
}
# Finish remove upstream rules files
finish_rm_upstream_rules()
{
finish_rm_conffile /etc/udev/rules.d/50-udev-default.rules
finish_rm_conffile /etc/udev/rules.d/80-drivers.rules
}
# Undo remove the finish init script
undo_rm_finish_init()
{
undo_rm_conffile /etc/init.d/finish
}
# Finish remove of the finish init script
finish_rm_finish_init()
{
finish_rm_conffile /etc/init.d/finish
}
# Remove configuration and log files
purge_files()
{
if [ -f /etc/iftab ]; then
rm -f /etc/iftab || true
fi
if [ -f /var/log/udev ]; then
rm -f /var/log/udev || true
fi
}
case "$1" in
remove)
;;
purge)
finish_mv_persistent_disk_rules
finish_mv_cdrom_id_rules
finish_mv_upstream_rules
finish_rm_iftab_rules
finish_rm_early_rules
finish_rm_upstream_rules
finish_rm_finish_init
purge_files
;;
upgrade|failed-upgrade|disappear)
;;
abort-install|abort-upgrade)
# Abort upgrade from dapper
if dpkg --compare-versions "$2" lt "093-0ubuntu1"; then
undo_mv_persistent_disk_rules
fi
# Abort upgrade within feisty development cycle
if dpkg --compare-versions "$2" lt "108-0ubuntu1"; then
undo_mv_cdrom_id_rules
fi
# Abort upgrade from feisty
if dpkg --compare-versions "$2" lt "113-0ubuntu16"; then
undo_rm_iftab_rules
# Abort upgrade from gutsy development version
undo_rm_finish_init
fi
# Abort upgrade from gutsy
if dpkg --compare-versions "$2" lt "117-6"; then
undo_mv_upstream_rules
undo_rm_early_rules
# Abort upgrade from hardy development version
undo_rm_upstream_rules
fi
;;
*)
echo "$0 called with unknown argument \`$1'" 1>&2
exit 1
;;
esac
# Automatically added by dh_installinit
if [ "$1" = "purge" ] ; then
update-rc.d udev remove >/dev/null || exit $?
fi
# End automatically added section
# Automatically added by dh_installinit
if [ "$1" = "purge" ] ; then
update-rc.d udev-finish remove >/dev/null || exit $?
fi
# End automatically added section
exit 0